#pragma once
#include "View.h"
class ScrollBar :
	public View
{

	struct Arrow 
	{
		int length;
		int type; // 
	};

public:
	enum Type
	{
		TYPE_HORIZONTAL,
		TYPE_VERTICAL
	};

	ScrollBar(View* parent, Type type);
	virtual ~ScrollBar();

	void setLength(int length);
	int getLength();

	Type getType() { return type_;  }

	virtual bool isLockFocus() { return true; }

protected:
	virtual bool paintBackground(SkCanvas* canvas);

	virtual bool paintFrontground(SkCanvas* canvas);

	//virtual bool paintBorder(SkCanvas* canvas);

	virtual bool paintHover(SkCanvas* canvas);

	virtual bool paintFocus(SkCanvas* canvas);

	virtual bool paintPress(SkCanvas* canvas) { return false; }

	virtual bool processMouseEvent(MouseEvent& event);

	virtual bool updateLayout();

	// |<<##########--------------------------------->>|
	//   |-----------ContentLength-------------------|
	int getContentLength();

	// |<<##########--------------------------------->>|
	//        |-----------MoveLength-----------|
	int getMoveLength();
private:
	Type type_;
	unsigned int m_length;
	unsigned int m_stubLength;

	int m_lastMouseX;
	int m_lastMouseY;

	int m_pointLocation; // 0 ~ x() - m_stubLength

	float position_;

	unsigned int m_lastHeight;
	unsigned int m_lastWidth;

	Arrow startArrow_;
	Arrow endArrow_;
};

